Semi's DirectSound 3D Filter

What's this?

This is a DirectShow filter capable of playing two separate audio streams and mix them in a multispeaker system.
This is useful for playing multichannel AVI videos. The way to make this special AVIs will be explained later.

Some time ago, somebody wrote a filter that make possible to mix an AC3 audio stream into a standard Windows AVI file. That was great, but it has two important problems: AC3 streams are enromous and you needed an AC3 decoding filter. These filters come with DVD playback software like PowerDVD, WinDVD, ... . These filters are commercial and so, they can't be distributed without permission. They have also another problem, only PowerDVD supported multispeaker using my SB PCI 64 and it can't be used with Media Player.

I tried to make something different, a filter capable of positioning a standard audio stream using an interface compatible with more sound cards. I decided that DirectSound was the best choice. It works with any soundcard and performs hardware audio acceleration if available. It also works with 2, 4 or more speakers without any change, so it's the best.

 

Usage

1- Making Multichannel AVIs

    The first step is to make a multichannel AVI file, that is, an AVI file with a Video stream and an Audio stream with more than 2 channels. This is impossible to make using standard WAV files, so the solution is to make two stereo WAVs, one for the front channels and the other for the rear ones.

1.1 - Making the required audio files

     First, we'll create a stereo WAV file containing the front channels (left,center and right). This can be done with AC3Dec with the -zerorear option:

           AC3DEC DolbyDigital.VOB -zerorear -out front.wav

   Then compress this WAV file in the format you wish (MP3 or WMA recommended)

   Second, we have to create the WAV containig the rear channels, this can't be done with the standard AC3Dec. AC3Dec is not capable of silencing the front channels and the rear sound generated is not the true left and right channels, one is the sum and the other is the difference between the two real channels. I've made a custom AC3Dec version (SemiAC3) that can do this job. This version supports a new option called -zerolr that silences the front channels and the WAV obtained has the real left and right surround data. This AC3Dec version doesn't support 44100 hz downmixing. (Please, AC3Dec programmer, mail me)

        SemiAC3 DolbyDigital.VOB -zerolr -out rear.wav

   Again, compress the WAV file obtained.

1.2 - Multiplexing Video and Audio

    (I suppose that you know how to make a Video file from a VOB or other MPEG files.)
    You can left the Video stream in one file and the other two Audio streams in two files, but it is not recommended if you want to save them in a CD-ROM, since the reading head will be continuosly moving from one stream to other and it can damage you CD drive. The solution is to multiplex these three files into one.
   Video editing programs (like VirtualDub) doesn't allow you to make AVIs with more than one audio track. To make this, we are going to use GraphEdit, this utility comes with the DirectShow SDK and can be found in many DVD software sites.

   First, open GraphEdit and select Graph->Insert Filters under the DirectShow filters branch, select the AVI/WAV File Source and select the video file Repeat the same with the two WAV files obtained before.

    Your screen should look like this:

 

    Now add the filter called AVI Mux. and connect each file pin with an input pin. Like this:

    Remember the number of the pins you connect each file (input 1-> Video input 2 -> Front and input 3 -> Rear).
    Now right click in the AVI Mux and select Properties..., the property page will appear and you can adjust some parameters. Here is how I have set them. You can test with other values if you wish.

Now Add the File Writer Filter and select the name of the output AVI file. It shoud look like this:

Hit the Play Button and wait until it finishes. You will have an AVI file with two Sound streams.

 

2- Playing Multichannel AVIs

    Once the file has been created, you must create a Graph to play it, this graph can be opened with the Media Player. You can distribute this Graph file along with the AVI file, so anybody can play the file only opening the graph file with the Media Player (or MicroDVD, DIVXPlayer, ...).

2.1 Creating the graph

   Open Graphedit and select Render Media File... from the File menu.  

   This will create a graph using two DirectSound renderers, one for each audio channel (Note that this will play and you will hear the front and rear sounds mixed into the two speakers since the DirectSound buffers aren't exclusive) this is the default playing graph, the one that will be used by Media Player if the AVI is opened directly.

   Now, remove the two DirectSound Renderers (click each one and hit the Del key). It will be something like this:

    Insert the Semi's DirectSound 3D filter (it should be under the DirectSound filters branch, if it doesn't appear the filter is not registered, see below in Registering the filter). Now, remember what were the streams used for each channel (1 - Front   2 - Rear) and connect them accordingly to the filter.


Now save the graph. Graphedit stores the paths with the drive letter and absolute path, to remove it, use the included program RemovePath.

        RemovePath dolby.grf    


And that's all. You can try the graph opening it with Windows Media Player.

Remember that if you want to use the 3D sound, you must use the Graph file, not the AVI file.

 

3 - Registering the Filter

   In order to play the created graph, the filter must be registered in the system. To make it, just run the regsvr32.exe file that is in the System directory of Windows:

   c:\Windows\System\RegSvr32 DSound3d.ax        (You should copy the file to the System directory)

4 - Distributing the Filter

   This filter is Freeware and can be distributed without restrictions.

5 - Additional Information

   This filter is in beta state, so it could not work on your system, if this happens, let me know. Send me your computer specifications and what is the problem you see.

   It uses a 1 second prebuffer, I think it sould be big enough, but if you experience sound gaps or jumping sound, let me know and I'll increase the size (it is not a good idea to use a very big buffer). You can see the buffer state in the filter properties page.

6- History

1.10     -    Seeking improved, now it is faster and doesn't hangs. Supports any Sampling rate. Pause still
                 doesn't work. Added configuration dialog, just run Ds3dconf.exe.
1.00     -    First Version

7- Bugs

This is a beta version, so expect some bugs. I've removed all bugs I've found, but I'm sure there are still many. Keep in mind that I've written all the Filter from scratch and that there is not any sample about DirectShow sound rendering.

 

 

Miguel Angel Horna ( Semi )     mahorna@teleline.es

http://teleline.terra.es/personal/mahorna